<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header','admin');?>
<div class="subnav">
  <h2 class="title-1 line-x f14 fb blue lh28">
  	<a href="?m=sign_up&c=reg&a=init" style="font-size:14px;color: #0000FF"><em>返回上一级</em></a>  
  </h2>
</div>
<div class="pad-lr-10">
<div id="searchid" style="">
<form name="searchform" action="" method="get" >
<input type="hidden" value="<?php echo ROUTE_M;?>" name="m">
<input type="hidden" value="<?php echo ROUTE_C;?>" name="c">
<input type="hidden" value="<?php echo ROUTE_A;?>" name="a">
<input type="hidden" value="1" name="search">
<input type="hidden" value="<?php echo $_SESSION['pc_hash'];?>" name="pc_hash">
<table width="100%" cellspacing="0" class="search-form">
    <tbody>
		<tr>
		<td>
		<div class="explain-col">
			赛区：<?php echo form::select($district, $_GET['district'], $str = ' name="district" id="district" ', '请选择')?>
			<?php echo L('reg_title')?>：<?php echo form::select($list, $_GET['res_id'], $str = ' name="res_id" id="res_id" ', '请选择')?>
			<?php echo L('create_time')?>：<?php echo form::date('start_time',$_GET['start_time'],0,0,'false');?>- &nbsp;<?php echo form::date('end_time',$_GET['end_time'],0,0,'false');?>
            姓名：<input type="text" value="<?=$_GET['username']?>" name="username">
			<input type="submit" name="search" class="button" value="<?php echo L('search');?>" />
			<input type="submit" name="export" class="button" value="导出excel" />
            <div style="margin-top:-10px;"></div>
            <br/>
			去除显示字段：
			<select id="delete_field">
				<option value="">请选择</option>
				<?php foreach ($frist as  $k => $v) {?>
					<?php if($k!=0){?>
					<option value="<?=$v?>"><?=$v?></option>
					<?php }?>
				<?php }?>
			</select>
			<?php if(!empty($pagedata)){?>
			<span style=""><a href="?m=sign_up&c=reg&a=handle_all&id=<?=$_GET['res_id']?>" class="button">一键导入人才库</a></span>
			<?php }?>
		</div>
		</td>
		</tr>
    </tbody>
</table>
</form>
</div>
<div class="table-list">
    <table width="100%" cellspacing="0" >
        <thead>
            <tr>
            <?php foreach ($frist as $k=>$v) {?>
            	<th align='center' <?php if($k == 0){?>width="40"<?php }else {?> width="150"<?php }?>><?=$v?></th>
            <?php }?>
            <th width="50" align='center'><?php echo L('operations_manage');?></th>
            </tr>
        </thead>
    <tbody class="td-line">
    <?php
    $ks = $start;
    if (!empty($pagedata)){
    foreach ($pagedata as $v) {$ks++;?>
    <tr>
    	<?php foreach($v as $kk=>$k){
    		if ($kk == 0){
    		?>
		<td align='center'><?=$ks?></td>
		<?php }else if($kk == $frist_count-2){?>
        <td align='center' style="word-break:break-all;" width="150">
            <a href="javascript:;" onclick="onclickStatus(this);"><?php echo str_cut($k,120);?></a>
            <select name="status_log" style="display:none;" onchange="onchangestatus(this,'<?=$v[0]?>');">
                <option value="">请选择</option>
                <?php foreach($status_log as $vo){?>
                <option value="<?=$vo?>" <?php if ($vo==$k){ echo 'selected';}?>><?=$vo?></option>
                <?php }?>
            </select>
        </td>
        <?php }else {?>
		<td align='center' style="word-break:break-all;" width="150"><?php echo $k?str_cut($k,120):'<font color="red">（未设置）</font>';?></td>
		<?php }}?>
		<td align="center">
			<a href="?m=sign_up&c=reg&a=log_show&id=<?=$_GET['res_id']?>&uniq_id=<?=$v[0]?>">查看</a><br>
			<?php if($v[$kk-2] != '已导入'){?>
			<a href="?m=sign_up&c=reg&a=handle&id=<?=$_GET['res_id']?>&uniq_id=<?=$v[0]?>">导入人才库</a>
			<?php }else{?>
			<font color='green'>已导入</font>
			<?php }?>
		</td>
	</tr>
	<?php }
	} else {
		echo "<tr><td colspan='25' style='color:red;font-size:18px;text-align:center;'><span>暂无数据！</span></td></tr>";
		}?>
    </tbody>
    </table>
   <div id="pages"><?php echo $pages;?>
  </div>
</div>
<script type="text/javascript"> 
<!--
	$('#delete_field').change(function(){
		var delete_field = '<?=$field?>';
		var field = $(this).val();
		if (!field){
			alert('请选择去掉显示字段');
		} else {
			field += delete_field?'|'+delete_field:'';
		}
		window.location='?m=<?php echo ROUTE_M;?>&c=<?php echo ROUTE_C;?>&a=<?php echo ROUTE_A;?>&pc_hash=<?php echo $_SESSION["pc_hash"];?>&res_id=<?=$_GET["res_id"]?>&field='+field;
	})
	// //根据赛区选择报名
	// $('#district').change(function(){
 //        var district = $(this).val();
 //        if (district) {
 //            $.ajax({
 //                type:"post",
 //                url:"?m=sign_up&c=reg&a=ajax_reg_district&pc_hash=<?php echo $_SESSION['pc_hash'];?>",
 //                dataType: "json",
 //                data: {district:district,status:1},
 //                success:function(data){
 //                    if(data.status){
 //                        var jsonobj =  data.list;  
 //                        var _html = '<option value="">请选择</option>';
 //                        for(key in jsonobj){
 //                            _html +='<option value="'+jsonobj[key]['id']+'">'+jsonobj[key]['title']+'</option>';
 //                        }
 //                        $('#res_id').html(_html);
 //                    }else{
 //                        return false;
 //                    }
 //                }
 //            })
 //        } else {
 //            return false;
 //        }
 //    })
    //状态点击事件
    function onclickStatus(obj) {
        $(obj).hide();
        $(obj).siblings('select').show();
    }
    //状态改变事件
    function onchangestatus(obj,uniq_id) {
        var status = $(obj).val();
        if (status) {
            $(obj).hide();
            $(obj).siblings('a').html(status);
            $(obj).siblings('a').show();
            $.ajax({
                type:"post",
                url:"?m=sign_up&c=reg&a=ajax_log_status&pc_hash=<?php echo $_SESSION['pc_hash'];?>",
                dataType: "text",
                data: {uniq_id:uniq_id,status:status},
                success:function(data){

                }
            })
        } else {
            $(obj).hide();
            $(obj).siblings('a').show();
        }
        
    }

//-->
</script>
</body>
</html>
